package jude.java.money.ant;

import org.apache.commons.lang.StringUtils;
import org.apache.tools.ant.BuildException;

/**
 * 字符串替换
 */
public class Replace extends Base {
	
	private String source;
	private String find;
	private String replace;
	private String property;
	
	@Override
	public void execute() throws BuildException {
		if (isEmpty(source) || isEmpty(find) || isEmpty(property)) {
			return;
		}
		String r = StringUtils.replace(source, find, replace);
		getProject().setProperty(property, r);
	}

	public void setSource(String source) {
		this.source = source;
	}

	public void setFind(String find) {
		this.find = find;
	}

	public void setReplace(String replace) {
		this.replace = replace;
	}

	public void setProperty(String property) {
		this.property = property;
	}
	
	
}
